#!/usr/bin/env node

const  fs = require('fs');
const http=require('http');
const path =require('path');
const file=process.argv[2];
var ext = path.extName(file);
var data=fs.readFileSyns(file).toString('base64');
var url='data:image/'+ext.slice(1,ext.length)+';base64,'+data;
var html = `<!DOCTYPE html><html><head><title></title></head><body><img alt=`${path.basename(file,ext)}` src=`${url}`\></body>\n</html>`;
http.createServer(function(req.res){ 
  console.log(req.headers);
  res.end(html);
}).listen(8080);

